<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/登陆页面css.css">

</head>

<body>
<div id="header_color">
    <div id="Nr">
        <div id="TB_XT">
            <img>
            <div id="XT_color">
                <strong>教 务 管 理 系 统</strong>
            </div>
        </div>
        <div id="GS">
            <strong>&nbsp;&nbsp;ZFsoft</strong><br>
            <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在线考试登陆</span><br>
            <span>&nbsp;&nbsp;&nbsp;</span>
        </div>
        <div id="DL_color">
            <img id="DL_left" src="./picture/login_left.jpg" alt="">
        </div>
        <div id="DL_right">
            <div id="DL_JM_color">
                <div id="DL_JM_color01"></div>
                <div id="Yhdl">
                    <strong>用户登录</strong>
                    <span id="XG">&nbsp;/</span>
                    <span id="LOGIN">LOGIN</span>
                </div>
                <form id="tableact">
                    <table>
                        用户名称 ： <input type="text" id="user" name="user"></br>
                        用户密码 ： <input type="password" id="pwd" name="pwd"></br>

                        <select id="job" name="job">
                            <option value="student">学生</option>
                            <option value="teacher">教职工</option>
                        </select>


                        <div id="An">
                            <input class="loginButton" type="button" value="登陆" />
                            <input class="submitButton" type="button" value="注册学生" />
                        </div>
                        <span id="sp" style="color:red;"></span>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

</body>
<script src="webjars/jquery/2.1.0/jquery.min.js"></script>
<script>


$(function (){

    $(".loginButton").click(function (){
        var $tableact =  $('#tableact').serialize();
        $.get("/lo",$tableact,function (data){
            if (data == "查无此人") {
                $("#pwd").val("");
                $("#sp").text("账号或密码不对,请重新输入")
                return;
            }
            if(data == "Success"){
                $("#sp").text("")
                window.location.href="/toButtonHome";
            }
        })
    })



    $('.submitButton').click(function (){
        $.post("/addStudent",$tableact,function (data){
            if(data == "Success"){
                window.location.href="/toLogin";
            }else {
                return ;
            }
        })
    })

})

</script>

</html>